clear;
clc;

%% Preset Parameters
FileName    =   'Result_FiscalPolicy';
StdVec      =   [1 1 1 -1 -1 60 -10]'*0.01/4;
Param_Benchmark =   struct('KAPPA',0.00/4,'XI',1/82.5/4,'Pir_SS',0.02/4,...
                            'Flag_dE',0,'Flag_Price',0,...
                            'B_Total_SS',0.91,'b_lb',-0.29,...
                            'TrProb_H',0.96,'Prob_H',0.37,...
                            'TrProb_ext',0.92,'Prob_ext',0.33,...
                            'Fin_DomShare',0.79,'Fin_AdjCost',0.8,...
                            'Cons_FracH',0.60,...
                            'RHO_M_dom',0.68,'RHO_M_ext',0.81,'RHO_Y_H',0.50,'RHO_p_F',0.90,...
                            'Taylor_Pi',1.1,'Taylor_ir',0.87,...
                            'Cons_ElasTN',6.19,'Cons_ElasHF',6.19,...
                            'FiscalFlag_TAU', 1, 'FiscalFlag_T', 0, 'FiscalFlag_B', 0, 'FiscalFlag_G', 0,...
                            'FiscalFlag_B_Real', 0);

SOLUTION        =   Solver_Main(Setup_PP(Param_Benchmark),StdVec);
SOLUTION.IRF    =   TempFun_AugIRF(SOLUTION.PP,SOLUTION.SS,SOLUTION.MODEL,SOLUTION.EquJac,SOLUTION.IRF);
%% Generate Different Results
% T
TempParam       =   Param_Benchmark;
TempParam.FiscalFlag_TAU    =   0;
TempParam.FiscalFlag_T      =   1;

[IRF_T,SOLUTION_T] ...
                =   TempFun_NewIRF(Setup_PP(TempParam),SOLUTION.SS,SOLUTION.MODEL,SOLUTION.EquJac,StdVec);

% B
TempParam       =   Param_Benchmark;
TempParam.FiscalFlag_TAU    =   0;
TempParam.FiscalFlag_B      =   1;

[IRF_B,SOLUTION_B] ...
                =   TempFun_NewIRF(Setup_PP(TempParam),SOLUTION.SS,SOLUTION.MODEL,SOLUTION.EquJac,StdVec);

% G
TempParam       =   Param_Benchmark;
TempParam.FiscalFlag_TAU    =   0;
TempParam.FiscalFlag_G      =   1;

[IRF_G,SOLUTION_G] ...
                =   TempFun_NewIRF(Setup_PP(TempParam),SOLUTION.SS,SOLUTION.MODEL,SOLUTION.EquJac,StdVec);

% Fixed Real B
TempParam       =   Param_Benchmark;
TempParam.FiscalFlag_TAU    =   1;
TempParam.FiscalFlag_B      =   0;
TempParam.FiscalFlag_B_Real =   1;

[IRF_TAU_RealB,SOLUTION_TAU_RealB] ...
                =   TempFun_NewIRF(Setup_PP(TempParam),SOLUTION.SS,SOLUTION.MODEL,SOLUTION.EquJac,StdVec);


save('Results_AltFiscalPolicy.mat','SOLUTION','SOLUTION_T','SOLUTION_B','SOLUTION_G', 'SOLUTION_TAU_RealB', '-v7.3');
